package model

import (
	// "fmt"

	"gorm.io/gorm"
)

type Page struct {
	gorm.Model
	Identity string `json:"identity" gorm:"column:identity;type:varhcar(36);NOT NULL"` //唯一标识
	Title    string `json:"title" gorm:"column:title;type:varhcar(225);NOT NULL"`      //标题
	Content  string `json:"content" gorm:"column:content;type:varhcar(225);NOT NULL"`  //内容chan
}

func (Page) TableName() string {
	return "page"
}

func GetpageList(keyword string) *gorm.DB {

	return DB.Model(new(Page)).
		Where("title like ? OR content like ?", "%"+keyword+"%", "%"+keyword+"%")

	// data := make([]*Page, 0)
	// DB.Find(&data)
	// for _, val := range data {
	// 	fmt.Println(val)
	// }
}
